package com.sc.service.goods;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sc.dal.mapper.goods.GoodsStockMapper;
import com.sc.dal.model.goods.GoodsStock;

/**
 * 商品库存服务实现
 * @author maoyongbin
 * @日期 Mar 30, 2017 9:58:41 AM
 */
@Service
public class GoodsStockService {
	@Autowired
	private GoodsStockMapper goodsStockMapper;
	
	/**
	 * 新增商品库存
	 * @param goodsStock
	 * @return int
	 */
	public int insert(GoodsStock goodsStock){
		int resultInt = this.goodsStockMapper.insert(goodsStock);
		
		return resultInt;
	}

	/**
	 * 更新商品库存
	 * @param goodsStock
	 * @return int
	 */
	public int updateByPrimaryKey(GoodsStock goodsStock){
		int resultInt = this.goodsStockMapper.updateByPrimaryKey(goodsStock);
		
		return resultInt;
    }
	
	/**
     * 根据条件，查找商品货品数据
     * @param paramMap
     * @return List<GoodsStock>
     */
    public List<GoodsStock> selectList(Map<String, Object> paramMap){
    	List<GoodsStock> goodsStockList = this.goodsStockMapper.selectList(paramMap);
    	
    	return goodsStockList;
    }
    
    /**
     * 查询单个商品库存
     * @param stock
     * @return GoodsStock
     */
    public GoodsStock selectOne(GoodsStock stock){
    	GoodsStock goodsStock = this.goodsStockMapper.selectOne(stock);
    	
    	return goodsStock;
    }
}
